<template>
  <div class="container">
    <div class="left">
      <v-chart :option="option3"></v-chart>
    </div>
    <div class="right">
      <div class="top">排行榜</div>
      <div class="bottom">
        <div v-for="(item, index) in data1" :key="index" class="item">
            
                <div class="id">{{ index + 1 }}</div>
                <div class="name">{{ item.title }}</div>
                <div class="value">{{ item.sales }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { onMounted } from 'vue';
import { useDataStore } from '@/stores/dataStore';
import { storeToRefs } from 'pinia';

const store = useDataStore();
const { data1, option3 } = storeToRefs(store);

onMounted(() => {
  store.getSecondData();
 
});
</script>

<style scoped>
.container {
  display: flex;
  margin-top: 20px;
}
.left {
  width: 70%;
  height: 400px;
}
.right {
  width: 30%;
  height: 400px;
}
.top {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 10px;
}
.item{
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: rgb(125, 128, 131);
}
.bottom {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.item:nth-child(-n+3) .id  {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #409EFF;
    color: #fff;
    text-align: center;
}
.item:nth-child(n+4) .id  {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    text-align: center;
}
.name{
    width: 70%;
}
</style>
